package com.example.kemusan.mapper;

import com.example.kemusan.pojo.ResultInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ResultInfoMapper {

    /**
     * 插入考生的新成绩
     * @param resultInfo
     * @return
     */
    @Insert("insert into result_info values (null,#{idCard},#{finishTime},#{score},#{deductionItems})")
    public Integer insertResultInfo(ResultInfo resultInfo);

    /**
     * 根据idCard查询考生成绩
     * @param idCard
     * @return
     */
    @Select("select id, id_card, finish_time, score, deduction_items from result_info where id_card = #{idCard} order by finish_time desc")
    public List<ResultInfo> selectResultInfoByIdCard(String idCard);
}
